﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SampleTryouts.Models
{
    public class MinimumDiscountHelper : IDiscountHelper
    {

        public decimal ApplyDiscount(decimal totalParam
            //, out string desc
            )
        {
            var desc = string.Empty;
            if (totalParam < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            else if (totalParam > 100)
            {
                desc = "Amount more than $100, so 10% discount applied";
                return 0.9m * totalParam;
            }
            else if (totalParam > 10 && totalParam <= 100)
            {
                desc = "Amount less than $ 100, so $5 discount applied";
                return totalParam - 5.0M;
            }
            else
            {
                return totalParam;
            }
        }
    }
}